import { getTimes } from './../utils/utils';
import request from '@/utils/request';
/**
 * 客户中心相关接口
 * @param data
 *
 * @returns
 */
// 客户统计
export const cusStatBasicInfo = () => {
    return request({
        url: '/scrm-api/console/customer/statistics/info',
        method: 'GET'
    });
};
// 客户折线统计信息
export const cusLineInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/statistics/summary',
        method: 'POST',
        data
    });
};
// 客户群统计
export const groupBasicInfo = () => {
    return request({
        url: '/scrm-api/console/customer/statistics/group-info',
        method: 'GET'
    });
};
// 客户群统折线统计信息
export const groupLineInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/statistics/group-summary',
        method: 'POST',
        data
    });
};
// ++++++++++++++++++++++++++++++++++ 客户标签   +++++++++++++++++++++++++++++++++
// 获取标签组类别列表
export const getTagsList = () => {
    return request({
        url: '/scrm-api/console/customer/tag/list-group-type',
        method: 'GET'
    });
};
// 新建客户标签组
export const addTags = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/tag/create-group',
        method: 'POST',
        data
    });
};
// 获取客户标签列表
export const getCusTags2 = (data?: any) => {
    return request({
        url: '/scrm-api/console/customer/tag/list-tag',
        method: 'GET',
        params: data
    });
};
// 获取客户标签列表
export const getCusTags = (data?: any) => {
    return request({
        url: '/scrm-api/console/customer/tag/list-all-tag',
        method: 'GET',
        params: data
    });
};
// 删除客户标签组
export const delTagGroup = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/tag/del-group',
        method: 'POST',
        data
    });
};
// 编辑客户标签组
export const editTagGroup = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/tag/update-group',
        method: 'POST',
        data
    });
};
// 同步至企微
export const syncWE = () => {
    return request({
        url: '/scrm-api/console/customer/tag/sync/cust-tag',
        method: 'POST'
    });
};
// 合并至企微
export const syncToQW = () => {
    return request({
        url: '/scrm-api/console/customer/tag/sync/merge/cust-tag',
        method: 'POST'
    });
};
// 标签组类别列表
export const groupTypeList = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/tag/group-type-list',
        method: 'POST',
        data
    });
};
// 新建&编辑标签组类别
export const updateGroup = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/tag/update-group-type',
        method: 'POST',
        data
    });
};
// 删除标签组类别
export const delGroupTag = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/tag/del-group-type',
        method: 'POST',
        data
    });
};
// 标签组下的客户数量
export const tagNum = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/tag/num',
        method: 'POST',
        data
    });
};
// **********************  客户中心列表
// 客户中心-获取客户列表  mok数据
export const getCenterCustomerList = (data: any, type?: boolean) => {
    return request({
        url: '/scrm-api/console/customer/list',
        method: 'POST',
        // params: data
        [type ? 'data' : 'params']: data
    });
};

export const getCenterCustomerListPost = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/list',
        method: 'POST',
        data
    });
};

// 获取线索列表
export const getCluesList = (data: any) => {
    return request({
        url: '/scrm-api/console/clue/list-component',
        method: 'POST',
        data
    });
};

/**
 * 分配员工
 * @param {array} customer_list [客户ID]
 * @param {Array} work_user_list [员工ID]
 * @returns
 */
export const batchAssignStaff = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/batch-assign-staff',
        method: 'post',
        data
    });
};

/**
 * 批量分配员工
 * @param {number} select_type 是否全选
 * @param {array} customer_list [客户ID] 全选时为反选客户ID
 * @param {Array} work_user_list [员工ID]
 * @param {...searchParams} searchParams 客户列表查询参数
 * @returns
 */
export const batchAssignStaffAsync = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/batch-assign-staff/sync',
        method: 'post',
        data
    });
};

// 导出客户数据
export const exportCustomer = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/download/cust/list',
        method: 'post',
        data
    });
};

// 获取标签组类别列表
export const listGroupType = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/tag/list-group-type',
        method: 'get',
        params: data
    });
};

// 获取客户标签列表接口
export const listTag = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/tag/list-tag',
        method: 'get',
        params: data
    });
};
// 获取客户群标签组列表接口
export const listgroupTag = (data?: any) => {
    return request({
        url: '/scrm-api/console/customer/groupchat-tag/list-group-type',
        method: 'post',
        params: data
    });
};
// 获取客户群标签列表接口
export const grouplist = (data: any) => {
    return request({
        url: 'scrm-api/console/customer/groupchat-tag/list-tag',
        method: 'post',
        params: data
    });
};
// 添加客户
export const createCustomer = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/create',
        method: 'post',
        data
    });
};

// 录入客户
export const inputCustomer = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/input/cust',
        method: 'post',
        data
    });
};

//批量打标签接口
export const batchAddTag = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/batch-add-tag',
        method: 'post',
        data
    });
};

// 批量移除标签接口
export const batchRmTag = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/batch-rm-tag',
        method: 'post',
        data
    });
};
//批量打标签群接口
export const batchAddGroupTag = (data: any) => {
    return request({
        url: 'scrm-api/console/customer/group/batch-add-tag',
        method: 'post',
        data
    });
};

// 批量移除标签群接口
export const batchGroupRmTag = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/group/batch-rm-tag',
        method: 'post',
        data
    });
};
// 获取创建客户属性列表
export const getAttrList = (data?: any) => {
    return request({
        url: '/scrm-api/console/customer/create-attr/list',
        method: 'get',
        params: data
    });
};

// 客户详情
export const getCustomerDetail = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/info',
        method: 'get',
        params: data
    });
};

// 信息编辑接口
export const setUpdateCustomer = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/update',
        method: 'post',
        data
    });
};

// 事件名称列表
export const getEventList = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/event/list',
        method: 'get',
        params: data
    });
};

// 客户动态列表
export const getCustomerDynamic = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/dynamic',
        method: 'post',
        data
    });
};
// 客户动态列表新的
export const getCustomerDynamicList = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/dynamic-list',
        method: 'post',
        data
    });
};

// 最近关注
export const getFollowList = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/recent/concerns',
        method: 'get',
        params: data
    });
};

// 朋友圈
export const getWXGroup = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/moment/data',
        method: 'get',
        params: data
    });
};

// 添加员工
export const getEmployeeList = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/add/employee',
        method: 'get',
        params: data
    });
};

// 添加员工-互动轨迹
export const getStaffTrack = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/staff/interact/travel',
        method: 'get',
        params: data
    });
};

// 所在群
export const getGroupInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/group/data',
        method: 'get',
        params: data
    });
};

// 所在群-互动轨迹
export const getGroupTrack = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/group/interact/travel',
        method: 'get',
        params: data
    });
};

// 客户详情编辑标签
export const editCustTag = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/edit-cust-tag',
        method: 'post',
        data
    });
};

// ++++++++++++++++++++++++++++++++++ 客户流失   +++++++++++++++++++++++++++++++++
// 获取客户流失列表
export const getCusLossList = (data?: any) => {
    return request({
        url: '/scrm-api/console/customer/lost/list',
        method: 'post',
        data
    });
};
// 流失客户导出
export const exportCusList = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/download/cust/list',
        method: 'post',
        data
    });
};

// new-流失客户导出
export const exportLostList = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/lost/list/export',
        method: 'post',
        data
    });
};

export const getTime = (data: any) => {
    return request({
        url: 'scrm-api/console/customer/weiwork/sync-time',
        method: 'get',
        params: data
    });
};

// 添加跟进
export const addFollow = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/add/follow-up',
        method: 'post',
        data
    });
};
// 查看客户
export const customerShow = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/show',
        method: 'get',
        params: data
    });
};
// 编辑客户
export const baseUpdate = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/base/update',
        method: 'post',
        data
    });
};

// 退回客户
export const customerReturn = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/return',
        method: 'post',
        data
    });
};

// 获取当前还有多少次数
export const customerProtectNum = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/protect-pre',
        method: 'post',
        data
    });
};
// 设为保护
export const customerProtect = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/protect',
        method: 'post',
        data
    });
};

// 获取活动参与情况
export const activityJoin = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/activity/join-situation',
        method: 'post',
        data
    });
};

// 获取跟进列表 添加客户
export const followList = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/follow/list',
        method: 'post',
        data
    });
};
//获取客户当前数据
export const currentData = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/current-data',
        method: 'get',
        params: data
    });
};
// 企业客户 - 联系人列表
export const corpContacts = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/corp-contacts',
        method: 'post',
        data: data
    });
};
// 企业客户 - 联系人添加+编辑
export const handleCorpContacts = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/handle-corp-contacts',
        method: 'post',
        data: data
    });
};
// 企业客户 - 联系人删除
export const delCorpContacts = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/del-corp-contacts',
        method: 'get',
        params: data
    });
};
//获取添加或编辑的客户属性
export const custAttrList = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/cust-attr/list',
        method: 'get',
        params: data
    });
};
//抖音企业号列表
export const tiktokList = (data: any) => {
    return request({
        url: '/scrm-api/douyin/get-douyin-agent-list',
        method: 'post',
        data: data
    });
};

/**
 * 获取客户数据总览
 * @param data
 * @returns
 */
export const customerShopInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/shop-info',
        method: 'get',
        params: data
    });
};

/**
 * 关键指标分析数据导出
 * @param data
 * @returns
 */
export const summarySyncExport = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/statistics/summary/sync-export',
        method: 'post',
        data: data
    });
};

/**
 * 获取各个企微获客渠道统计数据
 * @param data
 * @returns
 */
export const customerStatistics = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/statistics/qw-cust/channel',
        method: 'post',
        data: data
    });
};

/**
 * 导出企微获客渠道统计数据
 * @param data
 * @returns
 */
export const customerStatisticsExport = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/statistics/qw-cust/channel/export',
        method: 'post',
        data: data
    });
};

/**
 * 导出企微获客渠道客户明细数据
 * @param data
 * @returns
 */
export const customerStatisticsSyncExport = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/statistics/qw-cust/channel/sync-export',
        method: 'post',
        data: data
    });
};

/**
 * 获取各个渠道活码获客场景统计数据
 * @param data
 * @returns
 */
export const customerChannelInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/statistics/channel-info',
        method: 'post',
        data: data
    });
};

/**
 * 导出渠道活码获客场景 统计数据
 * @param data
 * @returns
 */
export const customerChannelStatExport = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/statistics/channel-stat-export',
        method: 'post',
        data: data
    });
};

/**
 * 导出渠道活码获客场景 客户明细
 * @param data
 * @returns
 */
export const customerChannelCustExport = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/statistics/channel-cust-export',
        method: 'post',
        data: data
    });
};

/**
 * 导出渠道活码获客场景 活码数据
 * @param data
 * @returns
 */
export const liveCodeChannelExport = (data: any) => {
    return request({
        url: '/scrm-api/console/customer/statistics/channel-info-export',
        method: 'post',
        data: data
    });
};
